﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace KillBill.Installers.DataInstaller
{
    public partial class DataBaseSetUp : Form
    {
        public DataBaseSetUp()
        {
            InitializeComponent();
            saveFileDialog1 = new SaveFileDialog();
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
            InitialData.CompanyName = txtNombre_comp.Text;
            InitialData.CompanyAddress = txtDirec_comp.Text;
            InitialData.CompanyContactNumber = txtTelef_comp.Text;
            InitialData.CompanyContactMail = txtEmail_comp.Text;
            InitialData.OrderManagerPhone = txtTelef_rep.Text;
            InitialData.OrderManagerMail = txtEmail_rep.Text;



            InitialData.AutomaticEmail = email.Text;
            InitialData.MailServer = email_server.Text;
            InitialData.AutomaticMailUserName = nombre_usuario.Text;
            InitialData.AutomaticMailPassWord = contrasena.Text;

            InitialData.UserId = usuario_id.Text;
            InitialData.FirstName = nombre.Text;
            InitialData.LastName = apellido.Text;
            InitialData.Email = email1.Text;
            InitialData.Address = direccion.Text;
            InitialData.Phone = telefono.Text;

            saveFileDialog1.ShowDialog();
            ScriptGenerator scriptGenerator = new ScriptGenerator();
            scriptGenerator.GenerateScript(saveFileDialog1.FileName);
            MessageBox.Show("Se ha generado el script correctamente..");
            this.Close();
        }

        private void DataBaseSetUp_Load(object sender, EventArgs e)
        {
        }
        private void BtnSiguienteClick(object sender, EventArgs e)
        {
            switch (tab.SelectedIndex)
            {
                case 0:
                    tab.SelectedIndex = 1;
                    break;
                case 1:
                    tab.SelectedIndex = 2;
                    break;
            }
        }

        private void tab_SelectedIndexChanged(object sender, EventArgs e)
        {
            if(tab.SelectedIndex==2)
            {
                btnAceptar.Enabled = true;
                btnSiguiente.Enabled = false;
            }
            else
            {
                btnAceptar.Enabled = false;
                btnSiguiente.Enabled = true;
            }
        }

        private void btnCancelar_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
